/*----------------------------------------------------------------------------------------
*
*  Copyright 2019, Gao Hai Hui, <fromzeropoint@126.com>.  All rights reserved.
*  https://gitee.com/helloworldghh/xoskit.git
*  Use of this source code is governed by a MIT license
*  that can be found in the License file.
*
----------------------------------------------------------------------------------------*/
#ifndef __D9AC9A71_4DC6_442a_8551_8D81E04D259E__
#define __D9AC9A71_4DC6_442a_8551_8D81E04D259E__

#include "../macro/head.h"
#include "../release/head.h"

/////////////////////////////////////////////////////////////////////////////////////////
// 
namespace xos
{
    // 
    // select interface
    // 
    class i_select : public i_release
    {
    public:
        // 
        // event wait type.
        // 
        enum enumWaitRet
        {
            // 
            // wait ret. 
            // 
            EVENT_WAIT_OBJECT_0,

            // 
            // wait timeout
            // 
            EVENT_WAIT_TIMEOUT,

            // 
            // wait failed
            // 
            EVENT_WAIT_FAILED,

            // 
            // wait for ever ...
            // 
            EVENT_WAIT_INFINITE = 0xffffffff
        };

    protected:
        virtual ~i_select(){}

    public:
        // 
        // select function. the same as os select.
        // 
        virtual int select( i_socket * pRead[], int & nReadNum, 
            i_socket * pWrite[], int & nWriteNum, 
            i_socket * pError[], int & nErrorNum, 
            uint32_t uTimeout ) = 0;
    };
}

#endif // __D9AC9A71_4DC6_442a_8551_8D81E04D259E__
